//
//  FlutterMapControllerProtocol.h
//  Pods
//
//  Created by 伊小洛 on 2023/12/5.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "FlutterEnum.h"
#import <CoreLocation/CoreLocation.h>
#import "FlutterMapMarker.h"
#import "FlutterMapPolygon.h"
#import "FlutterMapPolyline.h"

#ifndef FlutterMapControllerProtocol_h
#define FlutterMapControllerProtocol_h

NS_ASSUME_NONNULL_BEGIN

@protocol FlutterMapChannelDelegate <NSObject>

- (void)didTapMarker:(NSString *)markerId;
- (void)didTapPolyline:(NSString *)polylineId;
- (void)didSingleTappedAtCoordinate:(CLLocationCoordinate2D)coordinate;
- (void)mapInitComplete;
@end
NS_ASSUME_NONNULL_END


NS_ASSUME_NONNULL_BEGIN
@protocol FlutterMapControllerProtocol <NSObject>

- (void)setDelegate:(id<FlutterMapChannelDelegate>)delegate;

- (nullable UIView *)flutterView;

/// 跟随模式
- (void)setUserTrackingMode: (UserTrackingMode)mode;

/// 是否展示用户位置
- (void)showsUserLocation: (BOOL)show;

/// 设置缩放级别（默认3-19，有室内地图时为3-20）
- (CGFloat)zoomLevel;
- (void)setZoomLevel: (CGFloat)zoomLevel animated: (BOOL)animated;


/// 设置当前地图的中心点，改变该值时，地图的比例尺级别不会发生变化
- (CLLocationCoordinate2D)centerPoint;
- (void)setCenterPoint: (CLLocationCoordinate2D)coordinate animated: (BOOL)animated;

/// 设置地图中心点偏移
- (void)setScreenAnchor: (CGPoint)screenAnchor;

/// 设置可见区域
- (void)initVisibleMapRect: (CGRect)zoomLevel edgePadding: (UIEdgeInsets)edgePadding animated: (BOOL)animated;
- (void)setVisibleMapRect: (CGRect)zoomLevel edgePadding: (UIEdgeInsets)edgePadding animated: (BOOL)animated;

/// 东南、西北两个经纬度转换为矩形
- (CGRect)convertToMapRectWithSouthwest: (CLLocationCoordinate2D)southwest northeast: (CLLocationCoordinate2D)northeast;

/// 地图上的点位转换为地图经纬度
- (CLLocationCoordinate2D)convertToCoordinate: (CGPoint)point from: (UIView *)view;

/// maker方法
- (void)addMarker: (FlutterMapMarker *)marker;
- (void)didChangeMarker: (FlutterMapMarker *)marker;
- (void)removeMarker: (FlutterMapMarker *)marker;

/// polygon方法
- (void)addPolygon: (FlutterMapPolygon *)polygon;
- (void)didChangePolygon: (FlutterMapPolygon *)polygon;
- (void)removePolygon: (FlutterMapPolygon *)polygon;

/// polyline方法
- (void)addPolyline: (FlutterMapPolyline *)polyline;
- (void)didChangePolyline: (FlutterMapPolyline *)polyline;
- (void)removePolyline: (FlutterMapPolyline *)polyline;

/// 截图
- (void)takeSnapshot:(CGRect) rect completion:(void(^)(UIImage * _Nullable)) completion;

@end

NS_ASSUME_NONNULL_END

#endif /* FlutterMapControllerProtocol_h */
